/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EndPane.java
 *
 * Created on Jan 9, 2012, 4:24:28 PM
 */
package views.panes;

import controller.human.Person;
import controller.human.PhysicalState;
import controller.human.Role;
import java.awt.GridLayout;
import javax.swing.JLabel;
import views.MafiaFrame;

/**
 *
 * @author darkdev
 */
public class EndPane extends javax.swing.JPanel {

    MafiaFrame gui;
    /** Creates new form EndPane */
    public EndPane(MafiaFrame gui) {
        initComponents();
        this.gui = gui;
        this.Good.setLayout(new GridLayout( gui.players.size(),2 ));
        this.Bad.setLayout(new GridLayout( gui.players.size(),2 ));
        for (Person p : gui.players) {
            if (p.getRole() == Role.Killer) {
                if (p.getPhysicalState() != PhysicalState.Dead) {
                     this.Bad.add(new ButtonUserDead(p.getName()));
                     this.Bad.add(new JLabel(p.getRole().toString(),javax.swing.SwingConstants.CENTER));
                }
                else{
                     this.Bad.add(new ButtonUser(p.getName(),null));
                     this.Bad.add(new JLabel(p.getRole().toString(),javax.swing.SwingConstants.CENTER));
                }
             
            }
            else{
                if (p.getPhysicalState() != PhysicalState.Dead) {
                     this.Good.add(new ButtonUserDead(p.getName()));
                     this.Good.add(new JLabel(p.getRole().toString(),javax.swing.SwingConstants.CENTER));
                     
                }
                else{
                     this.Good.add(new ButtonUser(p.getName(),null));
                     this.Good.add(new JLabel(p.getRole().toString(),javax.swing.SwingConstants.CENTER));
                }
             
            }
        }
        

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        Good = new javax.swing.JPanel();
        Bad = new javax.swing.JPanel();

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Bad Guys");

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Good Guys");

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Game Ended");

        javax.swing.GroupLayout GoodLayout = new javax.swing.GroupLayout(Good);
        Good.setLayout(GoodLayout);
        GoodLayout.setHorizontalGroup(
            GoodLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 197, Short.MAX_VALUE)
        );
        GoodLayout.setVerticalGroup(
            GoodLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 293, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout BadLayout = new javax.swing.GroupLayout(Bad);
        Bad.setLayout(BadLayout);
        BadLayout.setHorizontalGroup(
            BadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 197, Short.MAX_VALUE)
        );
        BadLayout.setVerticalGroup(
            BadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 293, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
                        .addGap(20, 20, 20))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(Good, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(Bad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(28, 28, 28))))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {Bad, Good});

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel2, jLabel3});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jLabel1)
                .addGap(3, 3, 3)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(Good, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Bad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel2, jLabel3});

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {Bad, Good});

    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Bad;
    private javax.swing.JPanel Good;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration//GEN-END:variables
}
